const express = require('express')
const router = express.Router()
const { verifyUser, getVerificationStatus } = require('../controllers/verificationController')
const { changePassword, updateUserInfo, getUserInfo } = require('../controllers/userController')
const { uploadFile } = require('../controllers/uploadController')
const { changePassword: changePasswordValidation, updateUserInfo: updateUserInfoValidation } = require('../middleware/validator/userValidator')
const { validateRequest } = require('../middleware/validator')
const { verifyToken } = require('../utils/jwt')
const upload = require('../middleware/upload')

// 获取用户信息
router.get('/', verifyToken(), getUserInfo)

// 实名认证路由
router.post('/verification', verifyToken(), verifyUser)

// 获取认证状态路由
router.get('/verification-status', verifyToken(), getVerificationStatus)

// 文件上传路由
router.post('/uploads', verifyToken(), upload.single('file'), uploadFile)

// 修改密码
router.put('/password', verifyToken(), changePasswordValidation, validateRequest, changePassword)

// 修改用户信息
router.put('/info', verifyToken(), updateUserInfoValidation, validateRequest, updateUserInfo)

module.exports = router 